function fn() {
  let score = prompt('输入成绩')
  score = parseFloat(score) // 转换成功就是数字，失败NaN
  if (isNaN(score)) {
    console.log('请输入数字')
    return // 终止函数，后面的语句不会再执行
  }
  if (score < 0) {
    return console.log('成绩不能是负数')
  }
  let scoreBox = document.getElementsByClassName('score-box')[0]
  if (score >= 90) {
    scoreBox.innerHTML = `score=${score},优秀`
  } else if (score >= 80) {
    scoreBox.innerHTML = `score=${score},良好`
  } else if (score >= 60) {
    scoreBox.innerHTML = `score=${score},中等`
  } else {
    scoreBox.innerHTML = `score=${score},重修`
  }
}

function fn1() {
  let n = prompt('输入科目数量：')
  n = parseInt(n)
  if (isNaN(n) || n < 1) {
    return console.log('科目数量是正整数')
  }
  let sum = 0
  for (let i = 0; i < n; i++) {
    let s = prompt('输入第' + (i + 1) + '门课成绩：')
    s = parseFloat(s)
    if (isNaN(s) || s < 0) {
      i--
      continue
    }
    sum += s
  }
  console.log(sum)
}
